#ifndef LOGICQDC_H
#define LOGICQDC_H

#include "LogicPool/LogicPool.h"

#define LOGIC_QDC_VERSION 25


class LogicQDC : public LogicPool
{

  protected:
    
    uint8_t startDelay;
    uint8_t stopDelay;
    uint8_t mode;
    uint16_t gateTime;
  
  public:

    LogicQDC(LogicInterface &iinterface, uint8_t number = 1) : 
        LogicPool(iinterface, 'Q', number), startDelay(0), stopDelay(0), mode(0), gateTime(0) {};
    ~LogicQDC() {};

    void Init();
    void Clear();
    
    int GetNEvents();
    bool Overflow();
    void ReadEvents(int16_t * data, uint16_t n);
    
    void SetMode(int mode);
    uint8_t GetMode() { return mode; };
    
    void SetStartDelay(uint8_t delay);
    uint8_t GetStartDelay() { return startDelay; };

    void SetStopDelay(uint8_t delay);
    uint8_t GetStopDelay() { return stopDelay; };

#if (LOGIC_QDC_VERSION >= 20)
    void SetGateTime(uint16_t delay);
#endif
    uint16_t GetGateTime() { return gateTime; };
};

#endif
